#!/usr/bin/env node

const Dog =require('./02-dog.js')

const log=console.log,
      taidi=new Dog('taidi',4),
      zangao=new Dog('zangao',6);

taidi.on('bark',onBark)
zangao.on('bark',onBark)
function onBark(){
  //log(this.name)
  log(`name:${this.name},energy:${this.energy}`)
}

setTimeout(()=>{
  log('taidi eat food');
  taidi.energy=3;
  log(taidi.energy);
},3000);
